#ifndef _HDL_I2C_H_
#define _HDL_I2C_H_

#include "app_header.h"

#define HDL_I2C_DEG		OFF

#define I2C_STA_OK		0
#define I2C_STA_BUSY	1
#define I2C_STA_IDLE	2
#define I2C_STA_NAK		3
#define I2C_STA_ARBITRATION_LOST	4
#define I2C_STA_TIMEOUT	5
#define I2C_STA_ADDRANK	6

typedef enum _i2c_direction
{
	i2c_trans_write,
	i2c_trans_read,
}HDL_I2C_TRANSFER_DIR_TYPEDEF;

/*
 * 主机传输结构体
 */
typedef struct _i2c_transfer_info
{
    unsigned char slaveAddress;      	/* 7位从机地址 			*/
    enum _i2c_direction direction; 		/* 传输方向 			*/
    unsigned int subaddress;       		/* 寄存器地址			*/
    unsigned char subaddressSize;    	/* 寄存器地址长度 			*/
    unsigned char *volatile data;    	/* 数据缓冲区 			*/
    volatile unsigned int dataSize;  	/* 数据缓冲区长度 			*/
}hdl_i2c_transfer_StructDef;

extern struct hal_i2c_if g_hdl_i2c_if;

////////////////////i2c analog/////////////////
#define I2C_SCL_GPIO_PORT	GPIO1	//uart4 TX
#define I2C_SCL_GPIO_PIN	28

#define I2C_SDA_GPIO_PORT   GPIO1	//uart4 RX
#define I2C_SDA_GPIO_PIN	29

#endif
